﻿<UserControl x:Class="SoftTeach.View.Noten.ArbeitWorkspaceView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:notenView="clr-namespace:SoftTeach.View.Noten"
             xmlns:notenViewModel="clr-namespace:SoftTeach.ViewModel.Noten"
             xmlns:softTeach="clr-namespace:SoftTeach" mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="800"
             Background="{StaticResource DefaultOfficeBackgroundBrush}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="250"/>
      <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0">
      <GroupBox Grid.Row="1" Padding="5" Header="Arbeiten" Margin="5"
                HeaderTemplate="{StaticResource GroupBoxHeader}">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
          </Grid.RowDefinitions>
          <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=AddArbeitCommand}" 
                    ToolTip="Neue Arbeit erstellen">
              <StackPanel Orientation="Horizontal">
                <Grid>
                  <Image Source="/SoftTeach;component/Images/Arbeit32.png"/>
                  <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
                </Grid>
              </StackPanel>
            </Button>
            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
                    Command="{Binding Path=DeleteArbeitCommand}" 
                    ToolTip="Aktuelle Arbeit löschen.">
              <StackPanel Orientation="Horizontal">
                <Grid>
                  <Image Source="/SoftTeach;component/Images/Arbeit32.png"/>
                  <Image Source="/SoftTeach;component/Images/RemoveOverlay32.png"/>
                </Grid>
              </StackPanel>
            </Button>
          </StackPanel>
          <DataGrid Grid.Row="2" Background="Transparent" SelectedItem="{Binding Path=CurrentArbeit, Mode=TwoWay}" ItemsSource="{Binding Source={x:Static softTeach:App.MainViewModel}, Path=Arbeiten}" AutoGenerateColumns="False" IsReadOnly="True">
            <DataGrid.Columns>
              <DataGridTextColumn Header="Klasse" Binding="{Binding Path=ArbeitKlasse.KlasseBezeichnung}"/>
              <DataGridTextColumn Header="Fach" Binding="{Binding Path=ArbeitFach.FachBezeichnung}" />
              <DataGridTextColumn Header="Nr" Binding="{Binding Path=ArbeitLfdNr}" />
              <DataGridTextColumn Header="Bezeichnung" Binding="{Binding Path=ArbeitBezeichnung}" />
            </DataGrid.Columns>
          </DataGrid>
        </Grid>
      </GroupBox>
    </Grid>
    <Border Grid.Column="1">
      <ContentControl Content="{Binding Path=CurrentArbeit}">
        <ContentControl.Resources>
          <DataTemplate DataType="{x:Type notenViewModel:ArbeitViewModel}">
            <notenView:ArbeitDetailView />
          </DataTemplate>
        </ContentControl.Resources>
      </ContentControl>
    </Border>
  </Grid>
</UserControl>
